import type { IForm } from '@/base-ui/form/types'

export const modalConfig: IForm = {
  formItems: [
    {
      field: 'inputslot',
      label: '插槽输入框',
      slotName: 'inputSlot',
      type: 'input',
      placeholder: '请输入技术名称'
    },
    {
      field: 'inputVal',
      label: '输入框',
      type: 'input',
      placeholder: '请输入技术名称',
      otherOptions: {
        required: true
      }
    },
    {
      field: 'selectVal',
      label: '下拉框',
      type: 'select',
      placeholder: '请输入技术简介',
      options: [
        { label: '选项一', value: '1' },
        { label: '选项二', value: '2' }
      ]
    },
    {
      field: 'textareaVal',
      label: '文本域',
      type: 'input',
      placeholder: '请输入技术简介',
      childrenProps: {
        type: 'textarea'
      }
    },
    {
      field: 'switchVal',
      type: 'switch',
      label: '开关'
    },
    {
      field: 'checkboxVal',
      type: 'checkbox',
      label: '选择',
      placeholder: '请选择',
      options: [
        { label: '选项一', value: '1' },
        { label: '选项二', value: '2' }
      ]
    },
    {
      field: 'radioVal',
      type: 'radio',
      label: '单选',
      placeholder: '请选择',
      options: [
        { label: '选项一', value: '1' },
        { label: '选项二', value: '2' }
      ]
    },
    {
      field: 'inputNumberVal',
      type: 'inputNumber',
      label: '数字',
      min: 1,
      max: 10,
      placeholder: '请输入名称'
    },
    {
      field: 'rateVal',
      type: 'rate',
      label: '评分'
    },
    {
      field: 'treeVal',
      type: 'treeSelect',
      label: '树形选择',
      placeholder: '请选择',
      childrenProps: {
        showCheckbox: true,
        renderAfterExpand: true
      },
      options: [
        {
          value: '1',
          label: 'Level one 1',
          children: [
            {
              value: '1-1',
              label: 'Level two 1-1',
              children: [
                {
                  value: '1-1-1',
                  label: 'Level three 1-1-1'
                }
              ]
            }
          ]
        },
        {
          value: '2',
          label: 'Level one 2',
          children: [
            {
              value: '2-1',
              label: 'Level two 2-1',
              children: [
                {
                  value: '2-1-1',
                  label: 'Level three 2-1-1'
                }
              ]
            },
            {
              value: '2-2',
              label: 'Level two 2-2',
              children: [
                {
                  value: '2-2-1',
                  label: 'Level three 2-2-1'
                }
              ]
            }
          ]
        },
        {
          value: '3',
          label: 'Level one 3',
          children: [
            {
              value: '3-1',
              label: 'Level two 3-1',
              children: [
                {
                  value: '3-1-1',
                  label: 'Level three 3-1-1'
                }
              ]
            },
            {
              value: '3-2',
              label: 'Level two 3-2',
              children: [
                {
                  value: '3-2-1',
                  label: 'Level three 3-2-1'
                }
              ]
            }
          ]
        }
      ]
    },
    {
      field: 'uploadVal',
      type: 'upload',
      label: '上传',
      slotName: 'uploadSlot',
      childrenProps: {
        action: 'https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15',
        headers: {
          Authorization: 'Bearer token'
        },
        limitationText: '只能上传jpg/png文件，且不超过500kb',
        tips: null,
        icon: 'UploadFilled',
        multiple: true
      }
    },
    {
      colLayout: {
        span: 24
      },
      field: 'editorVal',
      type: 'editor',
      label: '富文本'
    },
    {
      field: 'autocompleteVal',
      label: '自动补全',
      type: 'autocomplete',
      placeholder: '请输入技术简介',
      childrenProps: {
        fetchSuggestions: (queryString: string, cb: any) => {
          const results = []
          cb(results)
        }
      }
    }
  ],
  colLayout: {
    span: 12
  },
  itemStyle: {},
  rules: {
    inputVal: [{ required: true, message: '请选择名称', trigger: 'blur' }]
  }
}

export const defaultInfo = {
  checkboxVal: ['1', '2'],
  inputNumberVal: 2,
  inputVal: '111',
  radioVal: '2',
  rateVal: 3,
  selectVal: '1',
  switchVal: true,
  textareaVal: '2222',
  treeVal: '1-1-1',
  editorVal:
    '<p><strong>12312313</strong></p><p><strong>😄</strong></p><p><span style="color: rgb(255, 169, 64);"><strong>12312313221312</strong></span></p>'
}
